var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, n) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var n in e)
              Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
          })(e, n);
      };
      return function (e, n) {
        function o() {
          this.constructor = e;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        t(e, n),
          (e.prototype =
            null === n
              ? Object.create(n)
              : ((o.prototype = n.prototype), new o()));
      };
    })(),
  AXEnjoyResultView = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.sanguoItemListFn = {
          caller: e,
          code: 5281,
          method: function (t) {
            if (0 == t.code) {
              var n = t.list;
              if (e.currentPage >= 1) {
                if (0 == n.length) return void e.currentPage--;
              } else e.dataList = [];
              e.isloading = !1;
              for (var o = 0; o < n.length; o++) {
                var r = n[o],
                  i = void 0;
                r.bonusSliver > 0 && (i = r.bonusSliver + "银"),
                  r.bonusGold > 0 && (i = r.bonusGold + "金");
                var a = {
                  lbl_name: { text: r.name + "(" + r.roleId + ")" },
                  lbl_action: { text: e.getSide(r.side) },
                  lbl_reward: { text: i },
                };
                e.dataList.push(a);
              }
              0 == e.currentPage && (e.list_historyItem.array = e.dataList);
            }
          },
        }),
        (e.caicaiItemListFn = {
          caller: e,
          code: 5280,
          method: function (t) {
            if (0 == t.code) {
              var n = t.list;
              if (e.currentPage >= 1) {
                if (0 == n.length) return void e.currentPage--;
              } else e.dataList = [];
              e.isloading = !1;
              for (var o = 0; o < n.length; o++) {
                var r = n[o],
                  i = {
                    lbl_name: { text: r.name + "(" + r.id + ")" },
                    lbl_action: { text: e.getAction(r.type) },
                    lbl_reward: {
                      text: r.bonus + e.getMoenyType(r.type),
                      color: e.getMoenyColor(r.type),
                    },
                  };
                e.dataList.push(i);
              }
              0 == e.currentPage && (e.list_historyItem.array = e.dataList);
            }
          },
        }),
        (e.list_historyItem.vScrollBarSkin = ""),
        e.btn_historyback.on(Laya.Event.CLICK, e, e.onBackFn),
        WebSocketService.addListener(e.caicaiItemListFn),
        WebSocketService.addListener(e.sanguoItemListFn),
        e
      );
    }
    return (
      __extends(e, t),
      (e.openView = function (t) {
        null == this.instance && (this.instance = new e()),
          (this.instance.currentPage = 0),
          1 == t && WebSocketService.send({ c: 5280, d: { pageNum: 0 } }),
          2 == t && WebSocketService.send({ c: 5281, d: { pageNum: 0 } }),
          (this.instance.y = 35),
          Laya.stage.addChild(this.instance);
      }),
      (e.prototype.getSide = function (t) {
        return 1 == t
          ? "支援魏国"
          : 2 == t
          ? "支援蜀国"
          : 3 == t
          ? "支援吴国"
          : void 0;
      }),
      (e.prototype.getAction = function (t) {
        return 1 == t || 2 == t
          ? "猜少"
          : 3 == t || 4 == t
          ? "猜太"
          : 5 == t || 6 == t
          ? "猜上上签"
          : 7 == t || 8 == t
          ? "猜阴"
          : 9 == t || 10 == t
          ? "猜阳"
          : 11 == t || 12 == t
          ? "猜上签"
          : "";
      }),
      (e.prototype.getMoenyType = function (t) {
        return t % 2 == 1 ? "金" : "银";
      }),
      (e.prototype.getMoenyColor = function (t) {
        return t % 2 == 1 ? "#FFBB00" : "#FFFFFF";
      }),
      (e.prototype.onBackFn = function () {
        this.removeSelf();
      }),
      e
    );
  })(ui.SquareController.AXEnjoyResultViewUI);
